/**
 * 
 */
package group.anglers.om.core.persistence.serialization.impl;

import group.anglers.om.core.persistence.serialization.Column;
import group.anglers.om.core.persistence.serialization.Composite;

import java.util.ArrayList;
import java.util.List;

/**
 * @author an.pham
 * 
 */
public class CompositeImpl implements Composite {
	private String name;
	private Class<?> type;
	private List<Column> columns;

	protected CompositeImpl(){}
	
	protected CompositeImpl(String name, Class<?> type) {
		this.name = name;
		this.type = type;
	}

	@Override
	public List<Column> getColumns() {
		return columns;
	}

	@Override
	public String getName() {
		return name;
	}

	@Override
	public Class<?> getType() {
		return type;
	}

	public void setType(Class<?> type) {
		this.type = type;
	}

	public void setName(String name) {
		this.name = name;
	}

	public void setColumns(List<Column> columns) {
		this.columns = columns;
	}

	public void addColumn(Column column) {
		if (columns == null) {
			columns = new ArrayList<Column>();
		}

		columns.add(column);
	}

}
